import matplotlib.pyplot as plt

def generate_and_save_plot(x_values, y_values, colors, xlabel, ylabel, title, filename):
    plt.bar(x_values, y_values, color=colors)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.title(title)
    plt.xticks(x_values)
    plt.ylim(0, max(y_values) + 0.5)
    plt.savefig(filename, dpi=300)
    plt.show()

def generate_execution_time_plot(x_values, y_values, colors, xlabel, ylabel, title, filename):
    generate_and_save_plot(x_values, y_values, colors, xlabel, ylabel, title, filename)

def pic_block_execution_time():
    blocks = ['1', '2', '4']
    execution_times = [11.819897988510132, 6.9015550885063697, 6.0989679909933936]
    colors = ['red', 'green', 'blue']
    generate_execution_time_plot(blocks, execution_times, colors, 'Block Number', 'Running Time', 'Block Number and Running Time', 'blocknumber.png')

def pic_size_execution_time():
    sizes = ['256', '512', '1024']
    execution_times = [8.12689900398254395, 6.31247687339782715, 3.06976318359375]
    colors = ['orange', 'purple', 'pink']
    generate_execution_time_plot(sizes, execution_times, colors, 'Sizes', 'Running Time', 'Sizes and Running Time', 'sizes.png')

def pic_core_execution_time():
    cores = [1, 2, 3, 4, 5, 6, 7, 8]
    execution_times = [3.5494542121887207, 6.1985478401184082, 9.538579940795898, 4.242363929748535, 5.6499478816986084, 5.5026400089263916, 5.6319327354431152, 5.0072941780090332]
    colors = ['gray', 'cyan', 'magenta', 'yellow', 'brown', 'teal', 'olive', 'maroon']
    generate_execution_time_plot(cores, execution_times, colors, 'Cores', 'Running Time', 'Cores and Running Time', 'cores.png')

pic_block_execution_time()
pic_size_execution_time()
pic_core_execution_time()
